package com.xd.clap.controller;


import com.xd.clap.entity.AppUpdateVO;
import com.xd.clap.services.IAppUpdateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 熊林飞
 */
@Slf4j
@RestController
@RequestMapping("/update")
public class AppUpdateController {

    @Autowired
    private IAppUpdateService appUpdateService;

    @GetMapping("/checkUpdate")
    public AppUpdateVO checkUpdate(@RequestParam(value = "name",required = true) String name,
                                   @RequestParam(value = "version",required = true) String version){
        log.info("【检查更新】-----------------------应用名：{}，版本：{}", name, version);
//        if (StringUtils.isBlank(name) || StringUtils.isBlank(version)) {
//            return ResultResponse.fail(PARAMETER_ERROR.getCode(), PARAMETER_ERROR.getMessage());
//        }
        return appUpdateService.checkUpdate(name,version);
    }
}
